package com.lenovo.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.lenovo.dao.BaseDAO;
import com.lenovo.model.GUserResource;
import com.lenovo.service.UserResourceService;

/**
 * @author shanglj1
 * Date 2014.4.30
 */

@Repository
public class UserResourceServiceImpl implements UserResourceService {
	@Resource
	private BaseDAO dao;
	
	@Override
	public boolean save(GUserResource uresource) {
		// TODO Auto-generated method stub
		boolean status=false;
		try {
			dao.save(uresource);
			status=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return status;
	}

	@Override
	public boolean del(String id) {
		// TODO Auto-generated method stub
		boolean status=false;
		try {
			dao.delById(GUserResource.class, id);
			status=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return status;
	}

	@Override
	public boolean update(GUserResource uresource) {
		// TODO Auto-generated method stub
		boolean status=false;
		try {
			dao.update(uresource);
			status=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return status;
	}

	@Override
	public List<GUserResource> browse() {
		// TODO Auto-generated method stub
		return dao.listAll("GUserResource");
	}

	@Override
	public GUserResource load(String id) {
		// TODO Auto-generated method stub
		return (GUserResource) dao.loadById(GUserResource.class, id);
	}

}
